<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>紫色鹭</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style.css">
    <script src="../js/config.js"></script>

</head>
<body>
<div class="get_html">
    <div class="header_top">
        <div class="container">
            您好，欢迎来到紫色鹭
            <span class="noToken">
            <a target="_blank"  onclick="parent.location.href = 'login.html'">请登录</a>
            <a target="_blank"  onclick="parent.location.href = 'register_01.html'">免费注册</a>
        </span>
            <span class="hasToken">
            <a target="_blank" ></a>
            <a target="_blank"  class="loginOut">退出登录</a>
        </span>
            <div class="fr">
                <a target="_blank"  onclick="parent.location.href = 'index.html'">紫色鹭首页</a>
                <a target="_blank" class="go-shop"><img class="img_shopcar" src="../img/shopcar_01.png">购物车<span class="car_num">0</span>件</a>
                <a target="_blank" class="go-store">店铺关注</a>
                <a target="_blank" class="go-authentication">企业认证</a>
            </div>
        </div>
    </div>
    <script>
        $("body").on("click",".loginOut",function () {
            localStorage.removeItem("Token");
            localStorage.removeItem("userId");
            localStorage.removeItem("storeId");
            localStorage.removeItem("username");
            noNeedLogin.indexOf(pageName(window.location.href)) == -1?location.href = "login.html":location.reload()
        })
        function pageName(a) {
            var b = a.split("/");
            var c = b.slice(b.length - 1, b.length).toString(String).split(".").slice(0, 1)[0];
            return c;
        }
        //存企业认证的状态
        if(localStorage.getItem("Token") && $("#header_01_html").length != 0){
            updataCardNum();
            get_ajax("/sys/authentication/myAuthentication", {}, function (data) {
                localStorage.setItem('state',data.state);
            })
        }
    </script>
</div>
</body>
<script src="../js/config.js"></script>
<script>
    if(localStorage.getItem("Token")){
        //同步接口修改html代码后，赋值父元素
        ajax_async("/web/auth/info",{},function (data) {
            $(".hasToken a:first-child").text("你好，"+data.username);
            $(".noToken").hide();
            $(".hasToken").show();
            if(data.storeId){
                localStorage.setItem("storeId",data.storeId);
            }
            localStorage.setItem('type',data.type);
            localStorage.setItem('userId',data.id);
        })

    }else{
        $(".noToken").show();
        $(".hasToken").hide();
    }
    var get_html = $(".get_html").html();
    var _iframe = window.parent;
    var _div = _iframe.document.getElementById('header_01_html');
    $(_div).html(get_html);
</script>
</html>